// ts中使用数组有两种方式
//    数据类型[]
//    泛型 Array<数据类型>
// 数据类型
//    string number boolean .... interface
const arr1: number[] = [1, 2, 3];
const arr2: Array<string> = ["a", "b", "c"];

interface IUser1 {
  username: string;
  password: string;
}

const arr3: IUser1[] = [{ username: "啊啊啊", password: "123456" }];
const arr4: Array<IUser1> = [{ username: "嗯嗯嗯", password: "123456" }];

const arr5: { username: string; password: string }[] = [
  { username: "对对对", password: "123456" },
];

const arr6: Array<{ username: string; password: string | number }> = [
  { username: "速速速", password: "123456" },
];

const arr7: Array<number | string> = [1, 2, 3, "a"]; // 推荐
const arr8: (number | string)[] = [1, 2, 3, "a"]; // 不推荐
